{include file="header.html"}
<body>

<div class="navBar">
	<a class="left" href="wap.php?app=member&act=index"><i class="return"></i></a>
	<div class="titleView-x">服务中心</div>
	<a class="right" href="tel://020-82581511"><i class="member-call"></i></a>
</div>

<div class="member-server main-padding-top">
	<div class="pullRefresh">
		<div class="img"></div>
		<header class="ge-bottom ge-light">
			<ul class="switchView">
				<li {if !isset($type) || $type==1}class="this"{/if}><a href="wap.php?app=member&act=server&type=1">常见问题</a></li>
				<li {if isset($type) && $type==2}class="this"{/if}><a href="wap.php?app=member&act=server&type=2">视频教程</a></li>
				<li {if isset($type) && $type==3}class="this"{/if}><a href="wap.php?app=member&act=server&type=3">用户手册</a></li>
			</ul>
		</header>
		{if isset($type) && $type>1}
		<div class="cate">
			{foreach from=$data.categorys item=g}
			<a href="wap.php?app=member&act=server_video&type={$type}&category_id={$g->id}&name={$g->name}">
				<div style="background-image:url({$g->pic});"></div><span>{$g->name}</span>
			</a>
			{/foreach}
		</div>
		{else}
		<ul class="list">
			{foreach from=$data.servers item=g}
			<li>
				<a href="wap.php?app=member&act=server_detail&id={$g->id}">
					<i style="background-image:url({$g->pic});"></i>
					<div>
						<span class="title">{$g->title}</span>
						<span class="description">{$g->memo}</span>
					</div>
				</a>
			</li>
			{foreachelse}
			<div class="norecord">暂无内容</div>
			{/foreach}
		</ul>
		{/if}
	</div>

	<div class="submitView">
		<a href="wap.php?tpl=member.server_im" class="btn">联系客服</a>
	</div>
</div>
{include file="footer.html"}
{if !isset($type) || $type==1}
<script>
var offset = $('.pullRefresh .list > li').length;
function createHtml(g){
	var html = '<li>\
		<a href="wap.php?app=member&act=server_detail&id='+g.id+'">\
			<i style="background-image:url('+g.pic+');"></i>\
			<div>\
				<span class="title">'+g.title+'</span>\
				<span class="description">'+g.memo+'</span>\
			</div>\
		</a>\
	</li>';
	offset++;
	return html;
}
$(function(){
	$('.member-server').height($.window().height-$('.member-server').padding().top-$('.member-server').padding().bottom);
	$('.pullRefresh').pullRefresh({
		header : true,
		footer : true,
		footerNoMoreText : '- END -',
		refresh : function(fn){
			var _this = this;
			offset = 0;
			$.getJSON('api.php?app=member&act=server&type=1', function(json){
				if(json.error!=0){ $.overloadError(json.msg);return; }
				var html = '';
				if($.isArray(json.data.servers))for(var i=0; i<json.data.servers.length; i++)html += createHtml(json.data.servers[i]);
				_this.find('.list').html(html);
				fn();
			});
		},
		load : function(fn){
			var _this = this;
			$.getJSON('api.php?app=member&act=server&type=1', { offset:offset }, function(json){
				if(json.error!=0){ $.overloadError(json.msg);return; }
				var html = '';
				if($.isArray(json.data.servers))for(var i=0; i<json.data.servers.length; i++)html += createHtml(json.data.servers[i]);
				_this.find('.list').append(html);
				fn();
			});
		}
	});
});
</script>
{/if}